package server.business.controller;


import server.business.pojo.PatientTransfusionInformation;
import server.business.service.PatientTransfusionInformationService;
import server.business.utils.results.fzx.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author FZX
 * @since 2022-07-31
 */
@Controller
@RequestMapping("/patientTransfusionInformation")
public class PatientTransfusionInformationController {
    @Autowired
    private PatientTransfusionInformationService patientTransfusionInformationService;


    /**
     * 查询个人支付总金额
     * @return payTotle
     * @dictionary
     */
    @ResponseBody
    @GetMapping("/normal/getPayPrice")
    public Result getBloodPrice(String patientId) {
        List<Map<String, Object>> payTotle= patientTransfusionInformationService.listPayPrice(patientId);
        if (payTotle != null) {
            System.out.println(payTotle);
            return Result.success(payTotle);
        } else {
            return Result.fail();
        }
    }


    /**
     * 查询个人支付明细
     * @return payList
     * @dictionary
     */
    @ResponseBody
    @GetMapping("/normal/getPayPriceList")
    public Result getBloodAlonePrice(String payState,String patientId) {
        List<PatientTransfusionInformation> payList= patientTransfusionInformationService.listPayAlonePrice(payState,patientId);
        if (payList != null) {
            System.out.println(payList);
            return Result.success(payList);
        } else {
            return Result.fail();
        }
    }

    /**
     * 查询某一条输血记录
     * @return BloodRecored
     * @dictionary
     */
    @ResponseBody
    @GetMapping("/normal/getBloodRecoredById")
    public Result getBloodRecoredById( String bloodId) {
        List<PatientTransfusionInformation> BloodRecoredById= patientTransfusionInformationService.getBloodRecoredById(bloodId);
        if (BloodRecoredById != null) {
            System.out.println(BloodRecoredById);
            return Result.success(BloodRecoredById);
        } else {
            return Result.fail();
        }
    }
}
